const express = require('express')
const router = express.Router()
const controller = require('../controller/cases')
const auth = require('../middleware/auth')

router.post('/api/cases', controller.add)
router.delete('/api/cases/:id',  controller.remove)
router.put('/api/cases',  controller.update)
router.get('/api/cases',  controller.list)
router.get('/api/cases/:id',  controller.detail)
router.get('/cases', controller.showIndex)
router.get('/cases/add', controller.showAdd)
router.get('/cases/edit/:id', controller.showEdit)

router.post('/admin/cases', auth, controller.add)
router.delete('/admin/cases/:id', auth,  controller.remove)
router.put('/admin/cases', auth,  controller.update)
router.get('/admin/cases', auth,  controller.list)
router.get('/admin/cases/:id', auth,  controller.detail)

module.exports = router